/**
 * 商品服务相关接口 
 */
var request = require('./request.js');
var utils = require('../utils/utils.js');

module.exports = {
  /**
   * 查询所有门店商品
   * @param storeId 门店id
   * @param business 业态 RETAIL 零售,CATERING 餐饮,RETAIL_CATERING 零售和餐饮
   */
  getMenuProduct: function (storeId, business) {
    var params = {
      storeId: storeId,
      business: business
    }
    return request.get('/newretail/api/mall/product/store/getMenuProduct', params)
  },
  /**
   * 查询门店商品
   */
  query: function (postData) {
    return request.get('/newretail/api/mall/product/store/query', postData)
  },

  /**
   * 查询门店热门商品(仅查询上架状态)
   *  @param {string} storeId  门店Id等于
   */
  getStoreHotProduct: function (storeId) {
    var params = {
      storeId: storeId
    }
    return request.get('/newretail/api/mall/product/store/getStoreHotProduct', params)
  },

  /**
   * 根据门店商品详情
   * @param storeId  门店id
   * @param productId   门店商品id
   */
  getDetails: function (storeId, productId) {
    var params = {
      storeId: storeId,
      productId: productId
    }
    return request.get('/newretail/api/mall/product/store/getDetails', params)
  },
  /**
   * 搜索门店商品
   * @param page 当前页码，起始于1
   * @param pageSize 每页记录数，必须大于等于0且小于等于100，等于0时表示不分页查询全部数据， 大于0时表示分页查询
   * @param nameLikes  商品名称类似于
   * @param storeId  门店id
   * @param searchCount  总记录数
   */
  getSearchProduct: function (storeIdEquals, page, pageSize, nameLikes, searchCount) {
    var params = {
      storeIdEquals: storeIdEquals,
      page: page,
      pageSize: pageSize,
      nameLikes: nameLikes,
      searchCount: searchCount
    }
    return request.get('/newretail/api/mall/product/store/query', params)
  },
}